\input{../preamble}

%----------------------------------------------------------------------------------------
%	TITLE PAGE
%----------------------------------------------------------------------------------------

\title[第5讲]{第5讲 ：The Interface of OS} % The short title appears at the bottom of every slide, the full title is only on the title page
\subtitle{第五节：Interface for Performance}
\author{陈渝} % Your name
\institute[清华大学] % Your institution as it will appear on the bottom of every slide, may be shorthand to save space
{
	清华大学计算机系 \\ % Your institution for the title page
	\medskip
	\textit{yuchen@tsinghua.edu.cn} % Your email address
}
\date{\today} % Date, can be changed to a custom date


\begin{document}

\begin{frame}
\titlepage % Print the title page as the first slide
\end{frame}

%\begin{frame}
%\frametitle{提纲} % Table of contents slide, comment this block out to remove it
%\tableofcontents % Throughout your presentation, if you choose to use \section{} and \subsection{} commands, these will automatically be printed on this slide as an overview of your presentation
%\end{frame}
%
%%----------------------------------------------------------------------------------------
%%	PRESENTATION SLIDES
%%----------------------------------------------------------------------------------------
%
%%------------------------------------------------
%\section{第一节：课程概述} % Sections can be created in order to organize your presentation into discrete blocks, all sections and subsections are automatically printed in the table of contents as an overview of the talk
%%------------------------------------------------
%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction}
	
	
	\begin{columns}
	
	\begin{column}{.3\textwidth}	

%			\centering
			\includegraphics[width=1.\textwidth]{flexsc}


		\end{column}

\begin{column}{.3\textwidth}
	
	\includegraphics[width=1.\textwidth]{megapipe}
\end{column}



\begin{column}{.3\textwidth}	
		\includegraphics[width=1.\textwidth]{commuter}
\end{column}

\end{columns}

Reference: \\
\tiny Flexsc: Flexible System Call Scheduling with Exception-Less System Calls,OSDI 2010 \\
\tiny MegaPipe: A New Programming Interface for Scalable Network I/O, OSDI 2012 \\
\tiny The Scalable Commutativity Rule: Designing Scalable Software for Multicore Processors, SOSP 2013.  


\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{flexsc}
			
			
		\end{column}
		
		\begin{column}{.3\textwidth}
			
			\includegraphics[width=1.\textwidth]{megapipe}
		\end{column}
		
		
		
		\begin{column}{.3\textwidth}	
			\includegraphics[width=1.\textwidth]{commuter}
		\end{column}
		
	\end{columns}
	
%	\centering
	Improve performance: 
	\begin{itemize}
		\item synchronmous syscall is a legacy
		\item syscall is not for high-speed net
		\item syscall is not for multicore arch
	\end{itemize}
	
	
\end{frame}	

%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- FlexSC}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{flexsc}
			
			
		\end{column}
		
		\begin{column}{.7\textwidth}
		\includegraphics[width=1.\textwidth]{flexsc-motivation}
		\end{column}
		
	\end{columns}
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- FlexSC}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{flexsc}
			
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			\includegraphics[width=1.\textwidth]{flexsc-slow-sync-syscall}
		\end{column}
		
	\end{columns}
	
	
\end{frame}	



%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- FlexSC}
	
	
	\begin{columns}
		
		\begin{column}{.4\textwidth}	
			
			%			\centering
%			\includegraphics[width=1.\textwidth]{flexsc}
			\includegraphics[width=1.\textwidth]{flexsc-slow-sync-syscall}
			
		\end{column}
		
		\begin{column}{.6\textwidth}
			
		Key source of performance impact
		\begin{itemize}
			\item  Traditional system calls are synchronous
			and use exceptions to cross domains
			
			\item Kernel performance equally affected.
Processor efficiency for OS code is also cut
in half			
			\item On a Linux write() call:
			up to 2/3
			of the L1 data cache and data
			TLB are evicted
			

			
		\end{itemize}
	
		\end{column}
		
	\end{columns}
	
	
\end{frame}	



%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- FlexSC}
	
	
	\begin{columns}
		
		\begin{column}{.4\textwidth}	
			
			%			\centering
			%			\includegraphics[width=1.\textwidth]{flexsc}
			\includegraphics[width=1.\textwidth]{flexsc-arch}
			
		\end{column}
		
		\begin{column}{.6\textwidth}
			
			Exception-less syscalls
			\begin{itemize}
				\item  Remove synchronicity
				by decoupling invocation from execution
				
				
				\item Allow for batching, reduce indirect costs, fewer mode switches
				
				
				
				\item Allow for dynamic multicore specialization
				
				
				
			\end{itemize}
			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- FlexSC}
	
	
	\begin{columns}
		
		\begin{column}{.4\textwidth}	
			
			%			\centering
			%			\includegraphics[width=1.\textwidth]{flexsc}
			\includegraphics[width=1.\textwidth]{flexsc-arch}
			
		\end{column}
		
		\begin{column}{.6\textwidth}
			\includegraphics[width=1.\textwidth]{flexsc-perf}


			
		\end{column}
		
	\end{columns}

			\LARGE Contributions: Exception-less syscalls  \& FlexSC-Threads	
	
\end{frame}	
%-------------------------------------------------


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- MegaPipe}
	
	
	\begin{columns}
		
		\begin{column}{.5\textwidth}	
			
			%			\centering
			%			\includegraphics[width=1.\textwidth]{flexsc}
			\includegraphics[width=.8\textwidth]{megapipe-bad-small-msg}
			\includegraphics[width=.8\textwidth]{megapipe-bad-short-conn}
		\end{column}
		
		\begin{column}{.5\textwidth}
			\includegraphics[width=.8\textwidth]{megapipe-bad-multicore}
			BSD	Socket	 API	 Performance	 Issues
			\includegraphics[width=1.\textwidth]{megapipe-problem}
			
			
		\end{column}
		
	\end{columns}
	
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- MegaPipe}
			

			BSD	Socket	 API	 Performance	 Issues
\includegraphics[width=1.\textwidth]{megapipe-problem}			
			Issues	with	 message-­‐oriented	 workloads
			\begin{itemize}
				\item  System	call	 overhead
				
				
				\item Shared	listening	 socket
				
				
				
				\item  File	abstraction	 overhead
				
			\end{itemize}
	
	
\end{frame}	



%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- MegaPipe}
	\centering
	\includegraphics[width=.6\textwidth]{megapipe-method}			

	
	
\end{frame}	

%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- MegaPipe}

	\begin{columns}
	
	\begin{column}{.5\textwidth}	

		\includegraphics[width=.8\textwidth]{megapipe-share}

	\end{column}
	
	\begin{column}{.5\textwidth}
		\includegraphics[width=1.\textwidth]{megapipe-noshare}
		
		
	\end{column}
	
\end{columns}
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- MegaPipe}
	\Large Completion Notification	 Model
	\centering
	\includegraphics[width=.7\textwidth]{megapipe-completion-model}			
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- MegaPipe}
	\Large Multi‐core scalability (\#	of	 transactions)	

	\centering
	\includegraphics[width=.8\textwidth]{megapipe-bench-multicore}	
			
	\normalsize
	Key	abstraction:	 per-­‐core	 channel	\\
 	Enabling 3 optimizations: 
 	Batching,	 partitioning,	 lwsocket	  
 	

\end{frame}	



%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{commuter}
			\includegraphics[width=1.\textwidth]{commuter-good}
			
		\end{column}
		
		\begin{column}{.7\textwidth}
		
		\LARGE
		\begin{block}{ scalable software development}
			The real bottlenecks may be in the interface design
			
		\end{block}
		\centering
		\includegraphics[width=.6\textwidth]{commuter-problem}
		\includegraphics[width=.6\textwidth]{commuter-problem2}	
		\end{column}
		
	\end{columns}
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{commuter}
			\includegraphics[width=1.\textwidth]{commuter-good}
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			
			\LARGE
			\begin{block}{The scalable commutativity rule}
				Whenever interface operations commute,
				they can be implemented in a way that scales.
				
				
			\end{block}
			\centering
			\includegraphics[width=.8\textwidth]{commuter-rule-example}

		\end{column}
		
	\end{columns}
	
	
\end{frame}	



%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{commuter}
			\includegraphics[width=1.\textwidth]{commuter-good}
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			
			
			\begin{block}{The scalable commutativity rule}
				Whenever interface operations commute,
				they can be implemented in a way that scales.
				
				
			\end{block}
			The rule enables reasoning about scalability
			throughout the software design process
			
			
			\begin{itemize}
				\item  Design:			Guides design of scalable interfaces
				
				
				
				\item Implement:				Sets a clear implementation target
				
				
				
				
				\item  Test:				Systematic, workload-independent scalability testing
				
				
			\end{itemize}

			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{commuter}
			\includegraphics[width=1.\textwidth]{commuter-good}
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			
			
			\begin{block}{The scalable commutativity rule}
			Commutativity	is sensitive to
			operations,arguments, and	state
			
			\end{block}
		    \Large 
		    Formalizing the rule
		    
			\includegraphics[width=1.\textwidth]{commuter-formalize}
			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	

%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{commuter}
			\includegraphics[width=1.\textwidth]{commuter-good}
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			
			
			\begin{block}{The scalable commutativity rule}
				Commutativity	is sensitive to
				operations,arguments, and	state
				
			\end{block}
			\centering
			
			\includegraphics[width=.65\textwidth]{commuter-example-creat}
			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	



%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=.8\textwidth]{commuter-testing}

			
		\end{column}
		
		\begin{column}{.7\textwidth}

			\centering
			
			\includegraphics[width=.9\textwidth]{commuter-symbolic-model}
			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=.8\textwidth]{commuter-testing}
			
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			 Using the rules to build the scalable OS
			\centering
			
			\includegraphics[width=.8\textwidth]{commuter-test-rename}
			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=.8\textwidth]{commuter-testing}
			
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			Using the rules to build the scalable OS
			\centering
			
			\includegraphics[width=.8\textwidth]{commuter-test-linux}
			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	


%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=.8\textwidth]{commuter-testing}
			
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			Using the rules to build the scalable OS
			\centering
			
			\includegraphics[width=.8\textwidth]{commuter-test-sv6}
			
		\end{column}
		
	\end{columns}
	
	
\end{frame}	



%-------------------------------------------------
\begin{frame}[plain]
	\frametitle{Introduction -- Commuter}
	
	
	\begin{columns}
		
		\begin{column}{.3\textwidth}	
			
			%			\centering
			\includegraphics[width=1.\textwidth]{commuter}
			\includegraphics[width=1.\textwidth]{commuter-good}
			
		\end{column}
		
		\begin{column}{.7\textwidth}
			
			\Large
			\begin{block}{Refining POSIX with the rule}
				\begin{itemize}
				\item Lowest FD versus any FD
				\item stat versus xstat
				\item  Unordered sockets
				\item  Delayed munmap
				\item fork+exec versus posix\_spawn
				\end{itemize}
				
			\end{block}

		\end{column}
		
	\end{columns}
	
	
\end{frame}	
%-------------------------------------------------
%-------------------------------------------------
\end{document}